home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
NeXTSTEP 3.1 (Developer) [x86]
/
NeXT Step 3.1 Intel dev.cdr.dmg
/
NextDeveloper
/
Examples
/
SoundAndMusic
/
SoundLibrary
/
compresstest.c
< prev
next >
Wrap
Text File
|
1990-10-10
|
1KB
|
42 lines
/*
* compresstest - compress or decompress a soundfile. If the input file is in
* a linear format, it is compressed. If it is in a compressed format, it is
* decompressed. Compression may be bit-faithful (decompression
* reproduces the sound exactly) or non-bit-faithful. An integer controlling
* the compression amount can also be specified. See the documentation in
* /usr/include/sound/convertsound.h for more information.
*/
#import <sound/sound.h>
#import <stdio.h>
check_error(int err)
{
if (err) {
printf("Error : %d, %s\n",err,SNDSoundError(err));
exit(1);
}
return err;
}
main (int argc, char *argv[])
{
int err;
SNDSoundStruct *s1, *s2;
char *infile, *outfile;
int bitFaithful = 1;
int dropBits = 4;
if (argc != 3) {
printf("usage : compresstest file1 file2\n");
exit(1);
}
err = SNDReadSoundfile(argv[1] ,&s1);
check_error(err);
err = SNDCompressSound(s1, &s2, bitFaithful, dropBits);
check_error(err);
err = SNDWriteSoundfile(argv[2],s2);
check_error(err);
exit(0);
}